import { createI18n } from "vue-i18n";
import zhCN from '../lang/zh'
import en from '../lang/en'

// 确保从localStorage获取语言设置，如果没有则默认使用中文
const locale = localStorage.getItem("lang") || "zhCN"

const i18n = createI18n({
    locale,
    globalInjection: true,
    fallbackLocale: "zhCN",
    legacy: false,
    messages: {
        zhCN,
        en
    },
    // 添加以下配置
    silentTranslationWarn: true,
    silentFallbackWarn: true,
    missingWarn: false,
    fallbackWarn: false,
    allowComposition: true,
    useScope: 'global'
})

export default i18n